<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>09.set集合.html</title>
</head>
<body>
    <script>
   const myArray = ["北京","上海","北京","深圳"];

  const set02 = new Set(myArray);
  console.log(set02);
  console.dir(Array.from(set02));  // set 集合转为 数组
  console.dir([...set02]);  // set 集合转为 数组

console.log("=================================");
        const set = new  Set();
        set.add("北京")
        set.add("上海")
        set.add("北京")
        set.add("深圳")
        // set.clear()
        set.delete("北京")
        console.log(set.has("北京"));
        console.log(set.has("上海"));
        console.log(set.size);
        console.log(set.keys());
        console.log(set.values());
        console.log(set.entries());
        console.dir(set);

        // for(const value of set.values()) {
        //      console.log(value);
        // }

        for(const [key,value] of set.entries()) {
             console.log(key,value);
        }

        set.forEach(value => console.log(value))
  
    </script>
    
</body>
</html>